﻿@using StudentInfo.Areas.StudentArea.Resources.Views.Shared
@model IEnumerable<StudentInfo.Areas.StudentArea.ViewModels.StudentViewModel>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Студенты</h2>

<p>
    @Html.ActionLink(@SharedStrings.Create, "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            @Html.LabelFor(model => model.First().StudentName)
        </th>
         <th>
            @Html.LabelFor(model => model.First().Year)
        </th>
         <th>
            @Html.LabelFor(model => model.First().MarkList)
        </th>
    </tr>


@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink(@SharedStrings.Edit, "Edit", new { studentId = item.Id }) |
            @Html.ActionLink(@SharedStrings.Details, "Details", new { studentId = item.Id }) |
            @Html.ActionLink(@SharedStrings.Delete, "Delete", new { studentId = item.Id })
        </td>
        <td>
            @item.StudentName
        </td>
         <td>
            @item.Year
        </td>
        <td>
            @foreach (var mark in item.MarkList) {
                @Html.RouteLink(mark.ExamName, "Mark", new { controller = "Mark", action = "Details", markId = mark.Id} )
                <br />
            }
        </td>
    </tr>
}

</table>